package com.ctl.szmd.szmd.feature_wm.data.mapper.wm

import com.ctl.szmd.szmd.feature_wm.data.bean.CommonInfoForApiList
import com.ctl.szmd.szmd.feature_wm.data.mapper.Mapper
import com.ctl.szmd.szmd.feature_wm.data.model.WmDataListModel

/**
 * created by : chentl
 * Date: 2020/07/30
 */
class ListCommonInfoForApiList2WmDataListModel :
    Mapper<List<CommonInfoForApiList>, List<WmDataListModel>> {

    override fun map(input: List<CommonInfoForApiList>?): List<WmDataListModel>? {
        if (input != null) {
            val list = mutableListOf<WmDataListModel>()
            for (data in input) {
                list.add(
                    WmDataListModel(
                        id = data.InfoId,
                        title = data.Title,
                        infoSource = data.InfoSource,
                        bodyTxt = data.BodyTxt,
                        time = data.FormatCreateTime,
                        thumbnailNetPath = data.ThumbnailNetPath,
                        pageNetPath = data.PageNetPath,
                        typeName = data.TypeName,
                        visitCount = data.MobileVisitCount,
                        flowerCount = data.FlowerCount,
                        attachmentCount = data.AttachmentCount,
                        visitTypeNum = data.VisitTypeNum
                    )
                )
            }
            return list
        }
        return null
    }
}